<?php

/*
	[SupeSite] (C) 2007-2008 Comsenz Inc.
	$Id: batch.login.php 13411 2009-10-22 03:13:01Z zhaofei $
*/

include_once('./common.php');
include_once(S_ROOT.'./language/batch.lang.php');
//2015.5.27  yangliang
@include_once(S_ROOT.'./function/register.func.php');

session_start();

$action = empty($_GET['action'])?'':$_GET['action'];
if(empty($action)) exit('Access Denied');

if(postget('refer')) {
	$refer = postget('refer');
} else {
	if(!empty($_SERVER['HTTP_REFERER'])) {
		$refer = $_SERVER['HTTP_REFERER'];
	} else {
		$refer = S_URL_ALL;
	}
}

$login_count = $_SESSION['login_count'];
$add = 1;
switch ($action) {
	case 'logout':
		obclean();
		sclearcookie();
		setcookie('_refer', '');
		$msg = $lang['logout_succeed'];
		$_SGLOBAL['db']->query("DELETE FROM t_sys_user_session WHERE uid='$_SGLOBAL[supe_uid]'");

         $refer="/agent";
	   showmessage($msg, rawurldecode($refer),0);
		break;
	default:
		break;
}

setcookie('_refer', '');
showmessage('login_succeed', rawurldecode($refer));

?>